import cv2 as cv
import numpy as np

# 测试基于 openCV 提供的轮廓特征识别
img = cv.imread('big.png')
gray= cv.cvtColor(img,cv.COLOR_BGR2GRAY)
# xfeatures2d 该算法已经申请专利，开源OpenCV没有版权，新的OpenCV去掉了这个算法; 安装3.4.2.16版本可以使用
sift = cv.xfeatures2d.SIFT_create()
kp = sift.detect(gray,None)
img=cv.drawKeypoints(gray,kp,img)
cv.imwrite('headImg.jpg',img)

img=cv.drawKeypoints(gray,kp,img,flags=cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS)
cv.imwrite('sift_keypoints.jpg',img)

